package cn.xorange.commons.system.mapper.system;

import cn.xorange.commons.data.core.mapper.MBaseMapper;
import cn.xorange.commons.system.entity.system.SysPost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : yangjian
 * date : 2025/2/25
 * description :
 */
public interface SysPostMapper extends MBaseMapper<SysPost> {

    List<SysPost> selectManageList(@Param(value = "isAdmin") boolean isAdmin,
                                   @Param(value = "userId") long userId,
                                   @Param(value = "post") SysPost post);

    int delPostRoleId(@Param(value = "roleId") Long roleId);

    String selectRoleIdsByPostId(Long[] postIds);

    @Select("<script> select group_concat(distinct post_name separator ',') as post " +
            " from sys_user_post u,sys_post p " +
            "where u.post_id  = p.post_id " +
            "  and u.user_id = #{userId} </script> ")
    String selectPostNames(@Param(value = "userId")Long userId);

}
